package com.a3dweijing.wetouch2.adapter;

import android.content.Context;
import android.net.Uri;
import android.provider.ContactsContract;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.a3dweijing.wetouch2.Activity.InviteListActivity;
import com.a3dweijing.wetouch2.R;
import com.a3dweijing.wetouch2.Util.GlideUtil;
import com.a3dweijing.wetouch2.bean.ReferralcodeDate;

import java.util.List;

/**
 * Created by Yxd on 2018/4/9.
 */

public class InvitelistAdapter extends RecyclerView.Adapter<InvitelistAdapter.ViewHolder> {

    private List<ReferralcodeDate.ReferralListBean> listBean;
    private Context context;
    public InvitelistAdapter(List<ReferralcodeDate.ReferralListBean> listBean,Context context) {
        this.context=context;
        this.listBean=listBean;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recycle_invitelist_item,parent,false);
        ViewHolder viewHolder = new ViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        String user_head = listBean.get(position).getUser_head();
        String s = GlideUtil.getInstance().checkUrl(user_head);
        GlideUtil.getInstance().showByCircle(context, s,holder.imageView);
        holder.textView.setText("昵称："+listBean.get(position).getUser_name());
    }

    @Override
    public int getItemCount() {
        return listBean.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        ImageView imageView;
        TextView textView;
        public ViewHolder(View view) {
            super(view);
            imageView = view.findViewById(R.id.invite_head);
            textView = view.findViewById(R.id.invite_name);
        }
    }
}
